\(\int \csc ^6(e+f x) (a+b \sec ^2(e+f x))^2 \, dx\) [27]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 103 \[ \int \csc ^6(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=-\frac {\left (a^2+6 a b+6 b^2\right ) \cot (e+f x)}{f}-\frac {2 (a+b) (a+2 b) \cot ^3(e+f x)}{3 f}-\frac {(a+b)^2 \cot ^5(e+f x)}{5 f}+\frac {2 b (a+2 b) \tan (e+f x)}{f}+\frac {b^2 \tan ^3(e+f x)}{3 f} \]

[Out]

-(a^2+6*a*b+6*b^2)*cot(f*x+e)/f-2/3*(a+b)*(a+2*b)*cot(f*x+e)^3/f-1/5*(a+b)^2*cot(f*x+e)^5/f+2*b*(a+2*b)*tan(f*
x+e)/f+1/3*b^2*tan(f*x+e)^3/f

Rubi [A] (verified)

Time = 0.12 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.087, Rules used = {4217, 459} \[ \int \csc ^6(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=-\frac {\left (a^2+6 a b+6 b^2\right ) \cot (e+f x)}{f}+\frac {2 b (a+2 b) \tan (e+f x)}{f}-\frac {(a+b)^2 \cot ^5(e+f x)}{5 f}-\frac {2 (a+b) (a+2 b) \cot ^3(e+f x)}{3 f}+\frac {b^2 \tan ^3(e+f x)}{3 f} \]

[In]

Int[Csc[e + f*x]^6*(a + b*Sec[e + f*x]^2)^2,x]

[Out]

-(((a^2 + 6*a*b + 6*b^2)*Cot[e + f*x])/f) - (2*(a + b)*(a + 2*b)*Cot[e + f*x]^3)/(3*f) - ((a + b)^2*Cot[e + f*
x]^5)/(5*f) + (2*b*(a + 2*b)*Tan[e + f*x])/f + (b^2*Tan[e + f*x]^3)/(3*f)

Rule 459

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[ExpandI
ntegrand[(e*x)^m*(a + b*x^n)^p*(c + d*x^n)^q, x], x] /; FreeQ[{a, b, c, d, e, m, n}, x] && NeQ[b*c - a*d, 0] &
& IGtQ[p, 0] && IGtQ[q, 0]

Rule 4217

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*sin[(e_.) + (f_.)*(x_)]^(m_), x_Symbol] :> With[{ff = Fr
eeFactors[Tan[e + f*x], x]}, Dist[ff^(m + 1)/f, Subst[Int[x^m*(ExpandToSum[a + b*(1 + ff^2*x^2)^(n/2), x]^p/(1
 + ff^2*x^2)^(m/2 + 1)), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[m/2] && Integer
Q[n/2]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {\left (1+x^2\right )^2 \left (a+b+b x^2\right )^2}{x^6} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {\text {Subst}\left (\int \left (2 b (a+2 b)+\frac {(a+b)^2}{x^6}+\frac {2 (a+b) (a+2 b)}{x^4}+\frac {a^2+6 a b+6 b^2}{x^2}+b^2 x^2\right ) \, dx,x,\tan (e+f x)\right )}{f} \\ & = -\frac {\left (a^2+6 a b+6 b^2\right ) \cot (e+f x)}{f}-\frac {2 (a+b) (a+2 b) \cot ^3(e+f x)}{3 f}-\frac {(a+b)^2 \cot ^5(e+f x)}{5 f}+\frac {2 b (a+2 b) \tan (e+f x)}{f}+\frac {b^2 \tan ^3(e+f x)}{3 f} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(353\) vs. \(2(103)=206\).

Time = 2.67 (sec) , antiderivative size = 353, normalized size of antiderivative = 3.43 \[ \int \csc ^6(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=-\frac {\csc (e) \csc ^5(e+f x) \sec (e) \sec ^3(e+f x) \left (20 a (5 a+12 b) \sin (2 e)-32 \left (2 a^2+9 a b+12 b^2\right ) \sin (2 f x)-24 a^2 \sin (2 (e+f x))-108 a b \sin (2 (e+f x))-54 b^2 \sin (2 (e+f x))+8 a^2 \sin (4 (e+f x))+36 a b \sin (4 (e+f x))+18 b^2 \sin (4 (e+f x))+8 a^2 \sin (6 (e+f x))+36 a b \sin (6 (e+f x))+18 b^2 \sin (6 (e+f x))-4 a^2 \sin (8 (e+f x))-18 a b \sin (8 (e+f x))-9 b^2 \sin (8 (e+f x))+8 a^2 \sin (2 (e+2 f x))+96 a b \sin (2 (e+2 f x))+128 b^2 \sin (2 (e+2 f x))+40 a^2 \sin (4 e+2 f x)+8 a^2 \sin (4 e+6 f x)+96 a b \sin (4 e+6 f x)+128 b^2 \sin (4 e+6 f x)-4 a^2 \sin (6 e+8 f x)-48 a b \sin (6 e+8 f x)-64 b^2 \sin (6 e+8 f x)\right )}{1920 f} \]

[In]

Integrate[Csc[e + f*x]^6*(a + b*Sec[e + f*x]^2)^2,x]

[Out]

-1/1920*(Csc[e]*Csc[e + f*x]^5*Sec[e]*Sec[e + f*x]^3*(20*a*(5*a + 12*b)*Sin[2*e] - 32*(2*a^2 + 9*a*b + 12*b^2)
*Sin[2*f*x] - 24*a^2*Sin[2*(e + f*x)] - 108*a*b*Sin[2*(e + f*x)] - 54*b^2*Sin[2*(e + f*x)] + 8*a^2*Sin[4*(e +
f*x)] + 36*a*b*Sin[4*(e + f*x)] + 18*b^2*Sin[4*(e + f*x)] + 8*a^2*Sin[6*(e + f*x)] + 36*a*b*Sin[6*(e + f*x)] +
 18*b^2*Sin[6*(e + f*x)] - 4*a^2*Sin[8*(e + f*x)] - 18*a*b*Sin[8*(e + f*x)] - 9*b^2*Sin[8*(e + f*x)] + 8*a^2*S
in[2*(e + 2*f*x)] + 96*a*b*Sin[2*(e + 2*f*x)] + 128*b^2*Sin[2*(e + 2*f*x)] + 40*a^2*Sin[4*e + 2*f*x] + 8*a^2*S
in[4*e + 6*f*x] + 96*a*b*Sin[4*e + 6*f*x] + 128*b^2*Sin[4*e + 6*f*x] - 4*a^2*Sin[6*e + 8*f*x] - 48*a*b*Sin[6*e
 + 8*f*x] - 64*b^2*Sin[6*e + 8*f*x]))/f

Maple [A] (verified)

Time = 0.45 (sec) , antiderivative size = 154, normalized size of antiderivative = 1.50

method result size
parallelrisch \(\frac {\left (\left (-13 a^{2}-36 a b -48 b^{2}\right ) \cos \left (2 f x +2 e \right )+\left (a^{2}+12 a b +16 b^{2}\right ) \cos \left (4 f x +4 e \right )+\left (a^{2}+12 a b +16 b^{2}\right ) \cos \left (6 f x +6 e \right )+\left (-\frac {1}{2} a^{2}-6 a b -8 b^{2}\right ) \cos \left (8 f x +8 e \right )-\frac {25 a^{2}}{2}-30 a b \right ) \csc \left (\frac {f x}{2}+\frac {e}{2}\right )^{5} \sec \left (\frac {f x}{2}+\frac {e}{2}\right )^{5}}{960 f \left (\cos \left (3 f x +3 e \right )+3 \cos \left (f x +e \right )\right )}\) \(154\)
derivativedivides \(\frac {a^{2} \left (-\frac {8}{15}-\frac {\csc \left (f x +e \right )^{4}}{5}-\frac {4 \csc \left (f x +e \right )^{2}}{15}\right ) \cot \left (f x +e \right )+2 a b \left (-\frac {1}{5 \sin \left (f x +e \right )^{5} \cos \left (f x +e \right )}-\frac {2}{5 \sin \left (f x +e \right )^{3} \cos \left (f x +e \right )}+\frac {8}{5 \sin \left (f x +e \right ) \cos \left (f x +e \right )}-\frac {16 \cot \left (f x +e \right )}{5}\right )+b^{2} \left (-\frac {1}{5 \sin \left (f x +e \right )^{5} \cos \left (f x +e \right )^{3}}+\frac {8}{15 \sin \left (f x +e \right )^{3} \cos \left (f x +e \right )^{3}}-\frac {16}{15 \sin \left (f x +e \right )^{3} \cos \left (f x +e \right )}+\frac {64}{15 \sin \left (f x +e \right ) \cos \left (f x +e \right )}-\frac {128 \cot \left (f x +e \right )}{15}\right )}{f}\) \(190\)
default \(\frac {a^{2} \left (-\frac {8}{15}-\frac {\csc \left (f x +e \right )^{4}}{5}-\frac {4 \csc \left (f x +e \right )^{2}}{15}\right ) \cot \left (f x +e \right )+2 a b \left (-\frac {1}{5 \sin \left (f x +e \right )^{5} \cos \left (f x +e \right )}-\frac {2}{5 \sin \left (f x +e \right )^{3} \cos \left (f x +e \right )}+\frac {8}{5 \sin \left (f x +e \right ) \cos \left (f x +e \right )}-\frac {16 \cot \left (f x +e \right )}{5}\right )+b^{2} \left (-\frac {1}{5 \sin \left (f x +e \right )^{5} \cos \left (f x +e \right )^{3}}+\frac {8}{15 \sin \left (f x +e \right )^{3} \cos \left (f x +e \right )^{3}}-\frac {16}{15 \sin \left (f x +e \right )^{3} \cos \left (f x +e \right )}+\frac {64}{15 \sin \left (f x +e \right ) \cos \left (f x +e \right )}-\frac {128 \cot \left (f x +e \right )}{15}\right )}{f}\) \(190\)
risch \(-\frac {16 i \left (10 a^{2} {\mathrm e}^{10 i \left (f x +e \right )}+25 a^{2} {\mathrm e}^{8 i \left (f x +e \right )}+60 a b \,{\mathrm e}^{8 i \left (f x +e \right )}+16 a^{2} {\mathrm e}^{6 i \left (f x +e \right )}+72 a b \,{\mathrm e}^{6 i \left (f x +e \right )}+96 b^{2} {\mathrm e}^{6 i \left (f x +e \right )}-2 a^{2} {\mathrm e}^{4 i \left (f x +e \right )}-24 a b \,{\mathrm e}^{4 i \left (f x +e \right )}-32 b^{2} {\mathrm e}^{4 i \left (f x +e \right )}-2 a^{2} {\mathrm e}^{2 i \left (f x +e \right )}-24 a b \,{\mathrm e}^{2 i \left (f x +e \right )}-32 b^{2} {\mathrm e}^{2 i \left (f x +e \right )}+a^{2}+12 a b +16 b^{2}\right )}{15 f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{5} \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}\) \(210\)

[In]

int(csc(f*x+e)^6*(a+b*sec(f*x+e)^2)^2,x,method=_RETURNVERBOSE)

[Out]

1/960*((-13*a^2-36*a*b-48*b^2)*cos(2*f*x+2*e)+(a^2+12*a*b+16*b^2)*cos(4*f*x+4*e)+(a^2+12*a*b+16*b^2)*cos(6*f*x
+6*e)+(-1/2*a^2-6*a*b-8*b^2)*cos(8*f*x+8*e)-25/2*a^2-30*a*b)*csc(1/2*f*x+1/2*e)^5*sec(1/2*f*x+1/2*e)^5/f/(cos(
3*f*x+3*e)+3*cos(f*x+e))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 139, normalized size of antiderivative = 1.35 \[ \int \csc ^6(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=-\frac {8 \, {\left (a^{2} + 12 \, a b + 16 \, b^{2}\right )} \cos \left (f x + e\right )^{8} - 20 \, {\left (a^{2} + 12 \, a b + 16 \, b^{2}\right )} \cos \left (f x + e\right )^{6} + 15 \, {\left (a^{2} + 12 \, a b + 16 \, b^{2}\right )} \cos \left (f x + e\right )^{4} - 10 \, {\left (3 \, a b + 4 \, b^{2}\right )} \cos \left (f x + e\right )^{2} - 5 \, b^{2}}{15 \, {\left (f \cos \left (f x + e\right )^{7} - 2 \, f \cos \left (f x + e\right )^{5} + f \cos \left (f x + e\right )^{3}\right )} \sin \left (f x + e\right )} \]

[In]

integrate(csc(f*x+e)^6*(a+b*sec(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

-1/15*(8*(a^2 + 12*a*b + 16*b^2)*cos(f*x + e)^8 - 20*(a^2 + 12*a*b + 16*b^2)*cos(f*x + e)^6 + 15*(a^2 + 12*a*b
 + 16*b^2)*cos(f*x + e)^4 - 10*(3*a*b + 4*b^2)*cos(f*x + e)^2 - 5*b^2)/((f*cos(f*x + e)^7 - 2*f*cos(f*x + e)^5
 + f*cos(f*x + e)^3)*sin(f*x + e))

Sympy [F(-1)]

Timed out. \[ \int \csc ^6(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\text {Timed out} \]

[In]

integrate(csc(f*x+e)**6*(a+b*sec(f*x+e)**2)**2,x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.04 \[ \int \csc ^6(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {5 \, b^{2} \tan \left (f x + e\right )^{3} + 30 \, {\left (a b + 2 \, b^{2}\right )} \tan \left (f x + e\right ) - \frac {15 \, {\left (a^{2} + 6 \, a b + 6 \, b^{2}\right )} \tan \left (f x + e\right )^{4} + 10 \, {\left (a^{2} + 3 \, a b + 2 \, b^{2}\right )} \tan \left (f x + e\right )^{2} + 3 \, a^{2} + 6 \, a b + 3 \, b^{2}}{\tan \left (f x + e\right )^{5}}}{15 \, f} \]

[In]

integrate(csc(f*x+e)^6*(a+b*sec(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

1/15*(5*b^2*tan(f*x + e)^3 + 30*(a*b + 2*b^2)*tan(f*x + e) - (15*(a^2 + 6*a*b + 6*b^2)*tan(f*x + e)^4 + 10*(a^
2 + 3*a*b + 2*b^2)*tan(f*x + e)^2 + 3*a^2 + 6*a*b + 3*b^2)/tan(f*x + e)^5)/f

Giac [A] (verification not implemented)

none

Time = 0.39 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.37 \[ \int \csc ^6(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {5 \, b^{2} \tan \left (f x + e\right )^{3} + 30 \, a b \tan \left (f x + e\right ) + 60 \, b^{2} \tan \left (f x + e\right ) - \frac {15 \, a^{2} \tan \left (f x + e\right )^{4} + 90 \, a b \tan \left (f x + e\right )^{4} + 90 \, b^{2} \tan \left (f x + e\right )^{4} + 10 \, a^{2} \tan \left (f x + e\right )^{2} + 30 \, a b \tan \left (f x + e\right )^{2} + 20 \, b^{2} \tan \left (f x + e\right )^{2} + 3 \, a^{2} + 6 \, a b + 3 \, b^{2}}{\tan \left (f x + e\right )^{5}}}{15 \, f} \]

[In]

integrate(csc(f*x+e)^6*(a+b*sec(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/15*(5*b^2*tan(f*x + e)^3 + 30*a*b*tan(f*x + e) + 60*b^2*tan(f*x + e) - (15*a^2*tan(f*x + e)^4 + 90*a*b*tan(f
*x + e)^4 + 90*b^2*tan(f*x + e)^4 + 10*a^2*tan(f*x + e)^2 + 30*a*b*tan(f*x + e)^2 + 20*b^2*tan(f*x + e)^2 + 3*
a^2 + 6*a*b + 3*b^2)/tan(f*x + e)^5)/f

Mupad [B] (verification not implemented)

Time = 18.75 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.05 \[ \int \csc ^6(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {b^2\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f}-\frac {\frac {2\,a\,b}{5}+{\mathrm {tan}\left (e+f\,x\right )}^4\,\left (a^2+6\,a\,b+6\,b^2\right )+\frac {a^2}{5}+\frac {b^2}{5}+{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {2\,a^2}{3}+2\,a\,b+\frac {4\,b^2}{3}\right )}{f\,{\mathrm {tan}\left (e+f\,x\right )}^5}+\frac {2\,b\,\mathrm {tan}\left (e+f\,x\right )\,\left (a+2\,b\right )}{f} \]

[In]

int((a + b/cos(e + f*x)^2)^2/sin(e + f*x)^6,x)

[Out]

(b^2*tan(e + f*x)^3)/(3*f) - ((2*a*b)/5 + tan(e + f*x)^4*(6*a*b + a^2 + 6*b^2) + a^2/5 + b^2/5 + tan(e + f*x)^
2*(2*a*b + (2*a^2)/3 + (4*b^2)/3))/(f*tan(e + f*x)^5) + (2*b*tan(e + f*x)*(a + 2*b))/f